<!doctype html>
<%@page import="com.cn.ccp.util.CCPContants"%>
<jsp:directive.page import="com.cn.ccp.bean.UserBean" />
<%@page contentType="text/html;charset=UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<html>
<f:view>
<f:loadBundle var="messages" basename="messages"></f:loadBundle>
<head>
<meta charset="utf-8">
<title><h:outputText value="#{messages['system_title']}" /></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- styles -->
    <link href="<%=request.getContextPath()%>/css/bootstrap.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/css/bootstrap-responsive.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/css/custom.css" rel="stylesheet">
    <!--[if lt IE 9]>
      <script src="<%=request.getContextPath()%>/js/html5.js"></script>
    <![endif]-->
    <!-- Fav and touch icons -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-57-precomposed.png">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/images/icon/favicon.png">
    <script src="<%=request.getContextPath()%>/js/jquery-1.8.3.min.js"></script>
	<script src="<%=request.getContextPath()%>/js/bootstrap.js"></script>
    <style type="text/css" media="screen"> 
		html, body	{ height:100%; }
		body { margin:0; padding:0; overflow:auto; }   
		#flashContent { display:none; }
       </style> 
	
	<script type="text/javascript" src="<%=request.getContextPath()%>/flexpaper/js/flexpaper_flash.js"></script>
   <%
		UserBean users = (UserBean) session.getAttribute("userBean");
			if ((users == null) || (users.getUserName().equals(""))) {
	%>
		<jsp:forward page="../sessionInvalid.jsp" />
	<%
	}
	%>
</head>

<body class="bg-white" style="overflow-x:hidden;">
	 <h:form>
		<div class="row page-head">
			<h3 class="page-title">
				<i class="n-icon-selection  n-icon-black"></i><h:outputText value="#{messages['course_page_course_info']}"/>&nbsp;&gt;&nbsp;<b><h:outputText value="#{messages['course_page_course_swf']}" /></b>
			</h3>
			<h:commandLink value="#{messages['btn_back']}" action="main" styleClass="btn" immediate="true" style="margin-top:-42px;float:right;margin-right:20px;">
				</h:commandLink> 
		</div>
		<div style="margin-right: 20px">
			
				
				<div style="position:absolute;top:120px;align:center">
					<%
						String type = (String)session.getAttribute(CCPContants.FILE_TYPE);
						type = type.toUpperCase() ;
						if(type.equalsIgnoreCase("pdf")){
							
							%>
							<div id="pdfDivID" style="margin-left:60px;width:900px;height:800px;display: none">
								<!--[if IE]>  
								    <object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="100%" height="1050" border="0">   
								        <param name="_Version" value="65539">  <param name="_ExtentX" value="20108">  
								        <param name="_ExtentY" value="10866">  <param name="_StockProps" value="0">  
								        <param name="SRC" value="<%=request.getContextPath()%>/tempfile/<%=(String)session.getAttribute("videoFileName")%>">  
								    </object>  
								 <![endif]-->
								 <!--[if !IE]> <!-->  
									<object data="<%=request.getContextPath()%>/tempfile/<%=(String)session.getAttribute("videoFileName")%>" type="application/pdf" width="100%" height="1050px">  
								    	alt : <a href='http://get.adobe.com/cn/reader'>Adobe Reader.pdf </a>  
								    </object> 
								 <!-- <![endif]-->
							</div>
							<%
						}else{
							%>
							<div id="viewerPlaceHolder" style="width:900px;height:800px;margin-left:30px;display: none">
							</div>
							<%
						}
					%>
			         
			        <script type="text/javascript">
			        
			        	$('#viewerPlaceHolder').hide();
			        	$('#pdfDivID').hide();
			        
			        	var fileType = '<%=type%>' ;
			        	if(fileType == 'PDF'){
				        	$('#pdfDivID').show();
			        	}else{
			        		//$('#viewerPlaceHolder').show();
			        		
			        		document.write(tmh__make_ad_fodder('<%=request.getContextPath()%>/tempfile/<%=(String)session.getAttribute("videoFileName")%>', 900, 800));
			        	}
			        	
			        	function tmh__make_ad_fodder(src, width, height){ 
				        	src = src.replace(" ", ""); 
				        	var TEMP_IMAGE = '<img src="'+src+'" height='+height+'" width="'+width+'" border="0" />'; 
				        	var TEMP_FLASH = '<div id="viewerPlaceHolder" style="width:900px;height:800px;margin-left:100px"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' 
				        	+ ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" ' 
				        	+ ' height="'+height+'" width="'+width+'"> ' 
				        	+ '<param name="movie" value="'+src+'" /> ' 
				        	+ '<param name="quality" value="high" /> ' 
				        	+ '<param name="wmode" value="opaque" /> ' 
				        	+ '<EMBED src="'+src+'" quality="high" WIDTH="'+width+'" HEIGHT="'+height+'" ' 
				        	+ ' wmode="opaque" TYPE="application/x-shockwave-flash" ' 
				        	+ ' PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED> ' 
				        	+ '</object></div>'; 
				        	return (/\.swf$/gi.test(src) == true ? TEMP_FLASH : TEMP_IMAGE) 
				        	.replace(/\$src\$/gi, src) 
				        	.replace(/\$width\$/gi, width) 
				        	.replace(/\$height\$/gi, height);
			        	}
			        </script>
		        </div>
		 	</div>
	        </h:form>
</body>
</f:view>
</html>
